<script setup>
	import {
		ref
	} from 'vue';

	// 导入云对象
	const demoArt = uniCloud.importObject("demoArticles");

	const dataList = ref([]);

	const getData = async () => {
		let res = await demoArt.getArticlesWithUser();
		dataList.value = res.result.data;
	};
</script>
<template>

	<view class="layout">
		<view class="item" v-for="(item,index) in dataList" :key="item._id">
			<view> 标题：{{item.title}}</view>
			<view>内容：{{item.content}}</view>
			<view> 发布者：{{item?.user_id[0]?.nickname || "未命名"}} </view>
		</view>

	</view>

</template>
<style lang="scss" scoped>
	.layout {
		padding: 30rpx;

		.item {
			display: flex;

			.left {
				width: 200rpx;

				image {
					width: 100%;
				}
			}

			.right {
				flex: 1;
				padding-left: 30rpx;

				.desc {
					font-size: 38rpx;
				}

				.name {
					font-weight: bold;
				}
			}
		}
	}
</style>